{% extends 'djangobb_forum/base.html' %}
{% load forum_extras %}
{% load i18n %}

{% block content %}
<div id="profile" class="block2col">
	{% include 'djangobb_forum/profile/profile_menu.html' %}
	<div class="blockform">
		<h2><span>{{ profile.username }} - {% trans "Essentials" %}</span></h2>
		<div class="box">
			<form id="profile1" method="post">
				{% csrf_token %}
				<div class="inform">
					<fieldset>
						<legend>{% trans "Enter your username and password" %}</legend>
						<div class="infldset">
							{{ form.username.errors }}
							<label><strong>{{ form.username.label }}</strong><br>
							{{ form.username }}
							{% if not request.user.is_superuser %}
								{{ form.fields.username.initial }}
							{% endif %}
							<br></label>
							<p>
							{% if request.user.is_superuser %}
								<a href="{% url admin:user_change_password profile.id %}">{% trans "Change password" %}</a>
							{% else %}
								<a href="{% url auth_password_change %}">{% trans "Change password" %}</a>
							{% endif %}
							</p>
					</div>

					</fieldset>
				</div>
				<div class="inform">
					<fieldset>
						<legend>{% trans "Enter a valid e-mail address" %}</legend>
						<div class="infldset">
							{{ form.email.errors }}
							<label><strong>{{ form.email.label }}</strong><br>
							{{ form.email }}<br></label>
							{% if request.user.is_superuser %}
								<p><a href="{% url djangobb:misc %}?mail_to={{ profile }}">{% trans "Send e-mail" %}</a></p>
							{% endif %}

						</div>
					</fieldset>
				</div>
				<div class="inform">
					<fieldset>
						<legend>{% trans "Set your localisation options" %}</legend>
						<div class="infldset">
							{{ form.time_zone.errors }}
							<label>
								{% trans "Timezone: For the forum to display times correctly you must select your local timezone." %}<br>
							<br>
							{{ form.time_zone }}
							</label>
							{{ form.language.errors }}
							<label>
								{% trans "Language: You can choose which language you wish to use to view the forum" %}
							<br>
							{{ form.language }}
							<br></label>
						</div>
					</fieldset>
				</div>
				<div class="inform">

					<fieldset>
						<legend>{% trans "User activity" %}</legend>
						<div class="infldset">
							<p>{% trans "Registered:" %} {{ profile.date_joined|date:"Y-m-d" }}</p>
							<p>{% trans "Last post:" %} {{ profile.forum_profile.last_post }}</p>
							<label>{% trans "Posts:" %} {{ profile.forum_profile.post_count }} - 
							<a href="{% url djangobb:search %}?action=show_user&user_id={{ profile.id }}">{% trans "Show all posts" %}</a></p>
							</label>
						</div>
					</fieldset>
				</div>
				<p><input name="update" value="{% trans "Submit" %}" type="submit">{% trans "When you update your profile, you will be redirected back to this page." %}</p>
			</form>
		</div>

	</div>
	<div class="clearer"></div>
</div>
{% endblock %}

{% block controls %}
{% endblock %}
